//
//  DFeedbackViewController.m
//  dance
//
//  Created by aether on 2023/10/20.
//

#import "DFeedbackViewController.h"

@interface DFeedbackViewController ()

@property (nonatomic, strong) IBOutlet UIView *bg;
@property (nonatomic, weak) IBOutlet UIView *loginBg;

@end

@implementation DFeedbackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.title = @"用户反馈";
//    [self initViews];
}

- (void) initViews {
    CAGradientLayer *gl = [CAGradientLayer layer];
    gl.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.frame) + 20, CGRectGetHeight(self.view.frame));
    gl.startPoint = CGPointMake(0.5, 0);
    gl.endPoint = CGPointMake(0.5, 1);
    gl.colors = @[(__bridge id)[UIColor colorWithRed:71/255.0 green:0/255.0 blue:233/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:51/255.0 green:149/255.0 blue:247/255.0 alpha:0.0].CGColor];
    gl.locations = @[@(0), @(1.0f)];
    [self.bg.layer addSublayer:gl];
    
    
    CAGradientLayer *gl1 = [CAGradientLayer layer];
    gl1.frame = CGRectMake(0, 0, CGRectGetWidth(self.loginBg.frame) + 20, CGRectGetHeight(self.loginBg.frame));
    gl1.startPoint = CGPointMake(0, 0.5);
    gl1.endPoint = CGPointMake(1, 0.5);
    gl1.colors = @[(__bridge id)[UIColor colorWithRed:1/255.0 green:140/255.0 blue:255/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:68/255.0 green:57/255.0 blue:229/255.0 alpha:1.0].CGColor];
    gl1.locations = @[@(0), @(1.0f)];
    self.loginBg.layer.cornerRadius = 7;
    self.loginBg.layer.masksToBounds = YES;
    [self.loginBg.layer addSublayer:gl1];
}

- (void) viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    
    [self initViews];
}

#pragma mark - 事件

- (IBAction) submitClicked:(id)sender {
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"已发送，请等待消息" preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self.navigationController popViewControllerAnimated:YES];
    }];

    [alertController addAction:okAction];

    // 在视图控制器中展示UIAlert
    [self presentViewController:alertController animated:YES completion:nil];
}

@end
